xen: Clean up code style.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 19 Jul 2007 12:39:10 +0000 (13:39 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 19 Jul 2007 12:39:10 +0000 (13:39 +0100)
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/acpi/power.c
xen/arch/x86/acpi/suspend.c

index 09f11d0bb90770d5a22e5418c43b874e4f965d9a..69a2f1febf7243ba3f0ee093c401a8b5bcd812aa 100644 (file)
@@ -77,8 +77,8 @@ static void freeze_domains(void)
 {
     struct domain *d;
 
-    for_each_domain(d)
-        if (d->domain_id != 0)
+    for_each_domain ( d )
+        if ( d->domain_id != 0 )
             domain_pause(d);
 }
 
@@ -86,8 +86,8 @@ static void thaw_domains(void)
 {
     struct domain *d;
 
-    for_each_domain(d)
-        if (d->domain_id != 0)
+    for_each_domain ( d )
+        if ( d->domain_id != 0 )
             domain_unpause(d);
 }
 
@@ -100,7 +100,7 @@ static void acpi_sleep_prepare(u32 state)
 
     wakeup_vector_va = __acpi_map_table(
         acpi_sinfo.wakeup_vector, sizeof(uint64_t));
-    if (acpi_sinfo.vector_width == 32)
+    if ( acpi_sinfo.vector_width == 32 )
         *(uint32_t *)wakeup_vector_va =
             (uint32_t)bootsym_phys(wakeup_start);
     else
@@ -116,13 +116,13 @@ static int enter_state(u32 state)
     unsigned long flags;
     int error;
 
-    if (state <= ACPI_STATE_S0 || state > ACPI_S_STATES_MAX)
+    if ( (state <= ACPI_STATE_S0) || (state > ACPI_S_STATES_MAX) )
         return -EINVAL;
 
     __sync_lazy_execstate();
     pmprintk(XENLOG_INFO, "Flush lazy state\n");
 
-    if (!spin_trylock(&pm_lock))
+    if ( !spin_trylock(&pm_lock) )
         return -EBUSY;
     
     pmprintk(XENLOG_INFO, "PM: Preparing system for %s sleep\n",
@@ -131,7 +131,7 @@ static int enter_state(u32 state)
     freeze_domains();
 
     disable_nonboot_cpus();
-    if (num_online_cpus() != 1)
+    if ( num_online_cpus() != 1 )
     {
         error = -EBUSY;
         goto Enable_cpu;
@@ -143,7 +143,7 @@ static int enter_state(u32 state)
 
     local_irq_save(flags);
 
-    if ((error = device_power_down()))
+    if ( (error = device_power_down()) )
     {
         printk(XENLOG_ERR "Some devices failed to power down\n");
         goto Done;
@@ -151,7 +151,7 @@ static int enter_state(u32 state)
 
     ACPI_FLUSH_CPU_CACHE();
 
-    switch (state)
+    switch ( state )
     {
         case ACPI_STATE_S3:
             do_suspend_lowlevel();
@@ -264,11 +264,13 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
     ACPI_FLUSH_CPU_CACHE();
 
     outw((u16)acpi_sinfo.pm1a_cnt_val, acpi_sinfo.pm1a_cnt);
-    if (acpi_sinfo.pm1b_cnt)
+    if ( acpi_sinfo.pm1b_cnt )
         outw((u16)acpi_sinfo.pm1b_cnt_val, acpi_sinfo.pm1b_cnt);
 
     /* Wait until we enter sleep state, and spin until we wake */
-    while (!acpi_get_wake_status());
+    while ( !acpi_get_wake_status() )
+        continue;
+
     return_ACPI_STATUS(AE_OK);
 }
 
index 812d644e9f4619c2f222bab5330deea2df340cba..19bb2d3d676607cfde81d86b38d20392939f7e94 100644 (file)
@@ -1,11 +1,9 @@
 /*
- * Suspend support specific for i386.
- *
- * Distribute under GPLv2
- *
- * Copyright (c) 2002 Pavel Machek <pavel@suse.cz>
- * Copyright (c) 2001 Patrick Mochel <mochel@osdl.org>
+ * Portions are:
+ *  Copyright (c) 2002 Pavel Machek <pavel@suse.cz>
+ *  Copyright (c) 2001 Patrick Mochel <mochel@osdl.org>
  */
+
 #include <xen/config.h>
 #include <xen/acpi.h>
 #include <xen/smp.h>
 #include <asm/hvm/support.h>
 #include <asm/i387.h>
 
-/* Following context save/restore happens on the real context
- * of current vcpu, with a lazy state sync forced earlier. 
- */
 #if defined(CONFIG_X86_64)
-unsigned long saved_lstar, saved_cstar;
+static unsigned long saved_lstar, saved_cstar;
 #endif
+
 void save_rest_processor_state(void)
 {
-    /*
-     * Net effect of unlazy_fpu is to set cr0.ts and thus there's no
-     * need to restore fpu after resume.
-     */
-    if (!is_idle_vcpu(current))
+    if ( !is_idle_vcpu(current) )
         unlazy_fpu(current);
 
 #if defined(CONFIG_X86_64)
@@ -46,9 +38,7 @@ void restore_rest_processor_state(void)
     struct tss_struct *t = &init_tss[cpu];
     struct vcpu *v = current;
 
-    /* Really scared by suffixed comment from Linux, and keep it for safe */
-    set_tss_desc(cpu, t);    /* This just modifies memory; should not be necessary. But... This is necessary, because 386 hardware has concept of busy TSS or some similar stupidity. */
-
+    set_tss_desc(cpu, t);
     load_TR(cpu);
 
 #if defined(CONFIG_X86_64)
@@ -58,7 +48,7 @@ void restore_rest_processor_state(void)
     wrmsr(MSR_STAR, 0, (FLAT_RING3_CS32<<16) | __HYPERVISOR_CS);
     wrmsr(MSR_SYSCALL_MASK, EF_VM|EF_RF|EF_NT|EF_DF|EF_IE|EF_TF, 0U);    
 #else /* !defined(CONFIG_X86_64) */
-    if (supervisor_mode_kernel && cpu_has_sep)
+    if ( supervisor_mode_kernel && cpu_has_sep )
         wrmsr(MSR_IA32_SYSENTER_ESP, &t->esp1, 0);
 #endif
 
@@ -74,7 +64,7 @@ void restore_rest_processor_state(void)
         loaddebug(&v->arch.guest_context, 7);
     }
 
-    /* Do we start fpu really? Just set cr0.ts to monitor it */
+    /* Reload FPU state on next FPU use. */
     stts();
 
     mtrr_ap_init();